import request from "@/utils/request";


/**
 * 创建一个微信的支付订单
 * @param data
 * @returns {Promise<unknown>}
 */
export function createWxOrder(data){
  return request({
    url: '/pay/createPayOrder',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 创建一个支付订单
 * @param data
 * @returns {Promise<unknown>}
 */
export function createPayOrderPOP(data){
  return request({
    url: '/pay/createPayOrderPOP',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 跳转支付页面
 * @param data
 * @returns {Promise<unknown>}
 */
export function skipPayment(data){
  return request({
    url: '/pay/skipPayment',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 创建一个汇款记录
 * @param data
 * @returns {Promise<unknown>}
 */
export function createRemittanceRecord(data){
  return request({
    url: '/pay/createRemittanceRecord',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 获取支付结果
 * @param data
 * @returns {Promise<unknown>}
 */
export function getPaymentResult(data){
  return request({
    url: '/pay/getPaymentResult',
    method: 'post',
    data,
    handleError: true,
  })
}

/**
 * 查询支付订单的信息
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function queryPayOrder(params){
  return request({
    url: '/pay/queryPayOrder',
    params,
    method: 'get',
  })
}


/**
 * 获取商家的充值记录
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getRechargeLog(params = {}){
  return request({
    url: '/pay/getRechargeLog',
    method: 'get',
    params
  })
}



